<%@ page language="java" contentType="text/html; charset=UTF-8" %>
<%@ include file="/jsplib/pubhead.jsp"%>
<%@ page import="net.comm.common.ValueMaping" %>
<%@ taglib uri="/WEB-INF/myTaglib.tld" prefix="tag"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<TITLE>会员资料管理</TITLE>
	<link href="${cpath}/css/youlin.css" rel="stylesheet" type="text/css" media="all" />
</head>
<body>
<!--外套 start -->
<div class="wrap">
  <!--页首 start -->
	<%@ include file="/menu.jsp"%>
  <!--页首 end -->  
  
  <!--导航面包屑 start -->
  <div class="breadCrumb">
  <div class="breadCrumbNav">当前位置：<a href="${cpath}/users.do?action=main">我的主页</a> >> <a>会员资料管理</a></div>
	<%@ include file="/navf.jsp"%> 
 </div> 
  <!--导航面包屑 end -->
  
  <!--主体 start -->
 <div class="body">
 
  <div class="hotBox1">  
    <div class="hotBox1-left">
      <img src="${cpath}/${myfn:getPic(theForm.picID)}" width="75" height="75"  class="shequ icon user_icon_2">
        <p class="nav">会员资料管理</p>
      </div>
    <div class="hotBox1-right">
      <p><a href="javascript:history.go(-1);"><img src="${cpath}/images/icon_32.gif" width="137" height="25" /></a></p>
      <p>&nbsp;</p>    
    </div>
  </div> 
   
 <div class="left-Box6">
  <h3>会员资料管理</h3>
  <div class="left-Box6-content">
   <div class="left-Box6-content-inner">   
	 <form action="${cpath}/users.do?action=update" name="theForm" id="theForm"  method="post" enctype="multipart/form-data"  class="frmAddTopic">

		<!--<p><label>Email:</label><input type="text" name='email' maxlength="100" value='${theForm.email}' class="long" onblur="this.value=DBC2SBC(this.value);check_email_input_new(this);" /><I  id=regemailinfo></I>
		</p>-->	
			<p><label>现住小区:</label>${myfn:getCnpcaName(theForm.work_location)}${myfn:getCnpcaName(theForm.work_sublocation)}${myfn:getCnpcaName(theForm.work_area)}${myfn:getVillageName(theForm.villageID)}小区
			<input type="text" name='building'  maxlength="50" value='${theForm.building}' class="w70" disabled="disabled"/>栋
			<input type="text" name='houseNo'  maxlength="50" value='${theForm.houseNo}' class="w70" disabled="disabled"/>号</p>			
			<!--<label>楼&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;栋:</label>	-->		
			<!--	
				<tag:CNPCA name="work_location" id="work_location" pid="0" cid="0" value='${theForm.work_location}'   onchange="getAjaxdata('cnpid',this.value)" onkeydown="catch_keydown(this);"  css='w70'/>
				<span id=cnpid style="display:inline">
				<c:if test="${theForm.work_location != 0}">
				<tag:CNPCA name="work_sublocation" pid="${theForm.work_location}" cid="0" value='${theForm.work_sublocation}'  onchange="getAjaxdata('cncid',this.value)" onkeydown="catch_keydown(this);"  css='w70'/>
				</c:if>
				<c:if test="${theForm.work_location == 0}">
				<select name='work_area' onkeydown='catch_keydown(this);'></select>
				</c:if>	
				</span>
				<span id=cncid style="display:inline">
				<c:if test="${theForm.work_sublocation != 0}">
				<tag:CNPCA name="work_area" id="work_area" cid="${theForm.work_sublocation}"  value='${theForm.work_area}'  onkeydown="catch_keydown(this);" onchange="getVillageSelect('villagediv',this.value)"  css='w70'/>
				</c:if>
				<c:if test="${theForm.work_sublocation == 0}">
				<select name='work_area' onkeydown='catch_keydown(this);'></select>
				</c:if>	
				</span>
				<span id=villagediv style="display:inline">
				<tag:VILLAGE name="villageID" work_area="${theForm.work_area}" value='${theForm.villageID}'   onkeydown="catch_keydown(this);"/>
				</span>小区-->					
	  <p><label>真实姓名:</label><input type="text" name='name' maxlength="50" value='${theForm.name}' class="short" /><I  id=regnameinfo></I></p>
	  <p><label>性&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;别:</label>
			<tag:ARRAY  id="sex" name="sex" options="<%=ValueMaping.SEX_TYPE%>" value='${theForm.sex}'/></p>
	  <p><label>身&nbsp;&nbsp;份&nbsp;&nbsp;证:</label>
		<input type="text" name='certno'  maxlength="30" value='${theForm.certno}' class="long" onblur="check_certno_input(this);"/>&nbsp;<I  id=regcertnoinfo ></I></p>
			<p><label>房产证号:</label><input type="text" name='fangchanNo' maxlength="100" value='${theForm.fangchanNo}' class="long" />&nbsp;<I  id=regfangchanNoinfo></I>					
			</p>					
			<p><label>房产证照:</label>
			<c:if test="${theForm.fcPicID > 0}">
			<a href="${cpath}/${myfn:getPic(theForm.fcPicID)}" target="_blank"><img src="${cpath}/icon/photo.gif" /></a>
			</c:if>
			<input type="file" name='fcPicIDPath' value='' class="long" onchange="check_loadfile(this);" /><I  id=regfcPicIDPathinfo></I>			
			</p>
			<p><label>个人头像:</label>
			<c:if test="${theForm.picID > 0}">
			<a href="${cpath}/${myfn:getPic(theForm.picID)}" target="_blank"><img src="${cpath}/icon/contact_grey.png" /></a>
			</c:if>		
			<input type="file" name='picIDPath' value='' class="long"  onchange="check_loadfile(this);" /><I  id=regpicIDPathinfo></I>					
			</p>					
	  <p><label>出生日期:</label>
		<input type="text" name='birthday' value='${theForm.birthday}' class="s150" />&nbsp;&nbsp;
		 <tag:ARRAY  id="birthdaySet" name="birthdaySet" options="<%=ValueMaping.USERSET_TYPE%>" value='${theForm.birthdaySet}' css="w50" />
	  </p>
	  <p>
	  <label>籍&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;贯:</label>
		<tag:CNPCA name="home_location" id="home_location" pid="0" cid="0" value='${theForm.home_location}'   onchange="getAjaxdata('homepid',this.value)" onkeydown="catch_keydown(this);" css="w70"/>&nbsp;
		<span id=homepid style="display:inline">
		<c:if test="${theForm.home_location != 0}">
		<tag:CNPCA name="home_sublocation" pid="${theForm.home_location}" cid="0" value='${theForm.home_sublocation}'   onkeydown="catch_keydown(this);"  css='w70'/>
		</c:if>
		<c:if test="${theForm.home_location == 0}">
		<select name='home_sublocation' onkeydown='catch_keydown(this);'></select>
		</c:if>
		</span>
		<tag:ARRAY id="home_Set" name="home_Set" options="<%=ValueMaping.USERSET_TYPE%>" value='${theForm.home_Set}' css="w50" />
		</p>
			<p><label>家庭状况:</label>
			<tag:ARRAY  id="famSts" name="famSts" options="<%=ValueMaping.FAMLIY_TYPE%>" value='${theForm.famSts}'/>&nbsp;<tag:ARRAY  id="famStsSet" name="famStsSet"  options="<%=ValueMaping.USERSET_TYPE%>" value='${theForm.famStsSet}' css="w50"/></p>

			<p><label>居住状况:</label>
			<tag:ARRAY  id="liveSts" name="liveSts" options="<%=ValueMaping.LIVE_TYPE%>" value='${theForm.liveSts}'/>&nbsp;<tag:ARRAY  id="liveStsSet" name="liveStsSet" options="<%=ValueMaping.USERSET_TYPE%>" value='${theForm.liveStsSet}' css="w50"/></p>
			<p><label>入住时间:</label>
			<input type="text" name='inTime' maxlength="8" value='${theForm.inTime}' class="w70"/>&nbsp;<tag:ARRAY  id="inTimeSet" name="inTimeSet" options="<%=ValueMaping.USERSET_TYPE%>" value='${theForm.inTimeSet}' css="w50"/><I  id=reginTimeinfo></I></p>

			<p><label>毕业中学:</label><input type="text" name='highSchool' maxlength="150" value='${theForm.highSchool}' class="w70" />&nbsp;时间:&nbsp;
			<input type="text" name='hsFinshDate' maxlength="8" value='${theForm.hsFinshDate}' class="w70" />
			<tag:ARRAY  id="schoolSet" name="schoolSet" options="<%=ValueMaping.USERSET_TYPE%>" value='${theForm.schoolSet}' css="w50"/>
			</p>
			<p><label>毕业大学:</label><input type="text" name='college' maxlength="150" value='${theForm.college}' class="w70" />&nbsp;时间:&nbsp;
			<input type="text" name='colFinshDate' maxlength="8" value='${theForm.colFinshDate}' class="w70" />
			<tag:ARRAY  id="schoolSet2" name="schoolSet2" options="<%=ValueMaping.USERSET_TYPE%>" value='${theForm.schoolSet2}' css="w50"/>
			</p>
			<p><label>服&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;役:</label>
			<tag:ARRAY  id="isArmy" name="isArmy" options="<%=ValueMaping.YESNO_FLAG%>" value='${theForm.isArmy}' css="w50" onchange="chgArmy(this.value);"/>&nbsp;
			<span id="spanarmy" style="display:none;">
			<tag:PROPERTY name="army"  assortID="1"  tagname='请选择' value='${theForm.army}' onkeydown="catch_keydown(this);" css="w70"/>
			<I  id=regemailinfo></I>
			<tag:ARRAY  id="armySet" name="armySet" options="<%=ValueMaping.USERSET_TYPE%>" value='${theForm.armySet}'  css="w50"/>
			</span> 
			</p>



			<p><label>所属行业:</label><input type="text" name='work' maxlength="150" value='${theForm.work}' class="short" />
			&nbsp;<tag:ARRAY  id="workSet" name="workSet" options="<%=ValueMaping.USERSET_TYPE%>" value='${theForm.workSet}' css="w50"/>
			</p>
			<!-- <p>
			<label>爱好关注:</label>
			<span class="myInfo-jg-right"> 		
			<input type="checkbox" name='chkboxinterest' value='1'
				<c:if test="${fn:indexOf(theForm.interest,'1,') > -1}">checked</c:if>		
			/>文学
			<input type="checkbox" name='chkboxinterest' value='2'
				<c:if test="${fn:indexOf(theForm.interest,'2,') > -1}">checked</c:if>				
			/>艺术
			<input type="checkbox" name='chkboxinterest' value='3'
				<c:if test="${fn:indexOf(theForm.interest,'3,') > -1}">checked</c:if>						
			/>运动
			<input type="checkbox" name='chkboxinterest' value='4'
				<c:if test="${fn:indexOf(theForm.interest,'4,') > -1}">checked</c:if>						
			/>科技
			<input type="checkbox" name='chkboxinterest' value='5'
				<c:if test="${fn:indexOf(theForm.interest,'5,') > -1}">checked</c:if>						
			/>娱乐
			<input type="checkbox" name='chkboxinterest' value='6'
				<c:if test="${fn:indexOf(theForm.interest,'6,') > -1}">checked</c:if>						
			/>亲子
			<input type="checkbox" name='chkboxinterest' value='7'
				<c:if test="${fn:indexOf(theForm.interest,'7,') > -1}">checked</c:if>						
			/>教育
			<input type="checkbox" name='chkboxinterest' value='8'
				<c:if test="${fn:indexOf(theForm.interest,'8,') > -1}">checked</c:if>						
			/>公益
			<input type="checkbox" name='chkboxinterest' value='9'
				<c:if test="${fn:indexOf(theForm.interest,'9,') > -1}">checked</c:if>						
			/>旅游
			<input type="checkbox" name='chkboxinterest' value='10'
				<c:if test="${fn:indexOf(theForm.interest,'10,') > -1}">checked</c:if>						
			/>时尚
			<input type="checkbox" name='chkboxinterest' value='11'
				<c:if test="${fn:indexOf(theForm.interest,'11,') > -1}">checked</c:if>						
			/>其他
			<tag:ARRAY  id="interestSet" name="interestSet" options="<%=ValueMaping.USERSET_TYPE%>" value='${theForm.interestSet}' css="w50"/>
			</span>  
			</p> -->
	  <p><label>生&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;肖:</label>
		<tag:ARRAY  id="chzodiac" name="chzodiac" options="<%=ValueMaping.SHXIAO_TYPE%>" value='${theForm.chzodiac}'/>
	  </p>
	  <p><label>星&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;座:</label>
		<tag:ARRAY  id="star" name="star" options="<%=ValueMaping.STAR_TYPE%>" value='${theForm.star}'/>
	  </p>


	  <p><label>个人特长:</label>
		<input type="text" name='skill' value='${theForm.skill}' class="s150" />&nbsp;&nbsp;
		<tag:ARRAY  id="skillSet" name="skillSet" options="<%=ValueMaping.USERSET_TYPE%>" value='${theForm.skillSet}' css="w50" />
	  </p>

		<p><label>个性签名:</label>
		<textarea name="introduction" rows="5" cols="50" >${theForm.introduction}</textarea>
		</p>

       <p class="btn">
       <a href="javascript:doConfirm();"><img src="${cpath}/images/icon_09.gif" /></a> 
       <a href="javascript:history.go(-1);"><img src="${cpath}/images/icon_33.gif" /></a>
       </p>
       
		<INPUT id=max_file_size type=hidden value=2048152 name=MAX_FILE_SIZE>
		<IMG id=oFileChecker style="WIDTH: 0px; HEIGHT: 0px" onload=check_photo_size()> 
		<!--隐藏域-->
		<input type="hidden" name='userID'		value='${userID}'/>
		<input type="hidden" name='nick'		value='${theForm.nick}'/>
		<input type="hidden" name='email'		value='${theForm.email}'/>
		<input type="hidden" name='mobile'		value='${theForm.mobile}'/>
		<input type="hidden" name='certtype'	value='${theForm.certtype}'/>
		<input type="hidden" name='fcNoSet'		value='${theForm.fcNoSet}'/>
		<input type="hidden" name='certSet'		value='${theForm.certSet}'/>
		<input type="hidden" name='picID'		value='${theForm.picID}'/>
		<input type="hidden" name='fcPicID'		value='${theForm.fcPicID}'/>
		<input type="hidden" name='interest'	value='${theForm.interest}'/>
		<input type="hidden" name='work_location'	value='${theForm.work_location}'/>
		<input type="hidden" name='work_sublocation'	value='${theForm.work_sublocation}'/>
		<input type="hidden" name='work_area'		value='${theForm.work_area}'/>
		<input type="hidden" name='villageID'		value='${theForm.villageID}'/>
     </form>
      </div>
   <div class="clearFloat"></div>
  </div>
</div>
  
    <div class="clearFloat"></div>
 </div> 
 <!--主体 end -->
 
 
 <!--页脚 start -->
	<%@ include file="/foot.jsp"%>
 <!--页脚 end --> 
</div>
<!--外套 end -->

</body>
</html>
<script>

	function check_photo_size()
	{
		img_temp = my_getbyid('oFileChecker');
		var limit = parseInt(my_getbyid('max_file_size').value);
		if (img_temp.fileSize > limit) {
			alert("照片文件过大，请选择2M以下的文件上传");
			return false;
		}
	}
	function check_loadfile(filePicker)
	{
		var patn = /.jpg$|.jpeg$|.gif$/i;  
		if(patn.test(filePicker.value)) {
			img_temp = my_getbyid('oFileChecker');
			img_temp.src = filePicker.value;
		} else {
			alert('您选择的不是合法的图片文件,支持文件格式：.jpg/.jpeg/.gif，请重新选择');
			filePicker.value='';
			return false;
		}
		return true;
	}
	function my_getbyid(id)
	{

		 itm = null;
		 if (document.getElementById)
		 {
				itm = document.getElementById(id);
		 }
		 else if (document.all)
		 {
				itm = document.all[id];
		 }
		 else if (document.layers)
		 {
				itm = document.layers[id];
		 }
		 
		 return itm;
	}

	//filter keywords
	function check_durty_words(thisinput)
	{

		var durty_words = new Array("系统","管理","master","版主","斑竹","客服","root","颁奖","活动","提示","兑奖","通知");
		for(i=0;i<durty_words.length;i++)
		{
			if (thisinput.indexOf(durty_words[i])>=	0)
			{
				return durty_words[i];
			}
		}
		return false;
	}

	function chgArmy(is)
	{
		if(is == '1'){
		
			my_getbyid('spanarmy').style.display="";
		}else{
		
			my_getbyid('spanarmy').style.display="none";
		}
	}
	chgArmy('${theForm.isArmy}');

	function chkForm_new(objForm)
	{

		var re = /^[_a-zA-Z0-9\-\.]+@([\-_a-zA-Z0-9]+\.)+[a-zA-Z0-9]{2,3}$/;
		var rs = /^[0-9]{2,3}$/;
		var rc = /^[0-9|a-z]{5}$/;
		var name = objForm.name.value;

		/*
		var nick = objForm.nick.value;
		var email = objForm.email.value;

		if (nick == "" || nick.replace(/(^\s*)|(\s*$)/g,"").length<2 || nick.replace(/(^\s*)|(\s*$)/g,"").length>16)
		{
			alert("【用户名】不能为空或格式不符合规范\n");
			objForm.nick.focus();
			return false;
		}
		if (filter)
		{
			alert("“"+filter+"”不能在【用户名】中使用\n");
			objForm.nick.focus();
			return false;
		}
		var filter = check_durty_words(objForm.nick.value);

	 
		for(var i=0;i<email.length;i++)
		{   
		   strCode=email.charCodeAt(i);   
		   if((strCode>65248)||(strCode==12288)){   
					 alert("【注册邮箱】含全角字符，请切换输入法，输入半角字符");
					 objForm.email.focus();
				   return false;
		   } 
		} 
		
		if (email != "" && !email.match(re))
		{
			alert("【注册邮箱】不能为空或格式不符合规范\n");
			objForm.email.focus();
			return false;
		}		
		var password = objForm.password.value;

		if (password != "" && (password.replace(/(^\s*)|(\s*$)/g,"").length < 6 || password.length > 20))
		{
			alert("【密码】长度不符合规范\n");
			objForm.password.focus();
			return false;
		}

		if (objForm.password.value != objForm.chkpass.value)
		{
			alert("【确认密码】与密码不一致\n");
			objForm.chkpass.focus();
			return false;
		}
		if (name == "" || name.replace(/(^\s*)|(\s*$)/g,"").length<2 || name.replace(/(^\s*)|(\s*$)/g,"").length>50)
		{
			alert("【真实姓名】不能为空或格式不符合规范\n");
			objForm.name.focus();
			return false;
		}

		*/
/*
		var work_location = objForm.work_location;
		if (work_location == null || work_location.value == "")
		{
			alert("请选择居住省份\n");
			objForm.work_location.focus();
			return false;
		}
		var work_sublocation = objForm.work_sublocation;
		if (work_sublocation == null )
		{
			alert("请选择居住地市\n");
			objForm.work_sublocation.focus();
			return false;
		}
		if (work_sublocation.value == "" || work_sublocation.value == "0")
		{
			alert("请选择居住地市\n");
			objForm.work_sublocation.focus();
			return false;
		}
		var work_area = objForm.work_area;
		if (work_area == null )
		{
			alert("请选择居住区县\n");
			objForm.work_area.focus();
			return false;
		}
		if (work_area.value == "" || work_area.value == "0")
		{
			alert("请选择居住区县\n");
			objForm.work_area.focus();
			return false;
		}
		var villageID = objForm.villageID;
		var village = objForm.village;
		if ((villageID == null ||villageID.value == "") && (village == null || village.value == ""))
		{
			alert("【小区】不能为空\n");
			return false;
		}




		var certno	= objForm.certno;
		if (certno.value.replace(/(^\s*)|(\s*$)/g,"").length > 0 )
		{
			var chkcertno	= isIdCardNo(certno);
			if (chkcertno != "校验正确！")
			{
				alert("【身份证】不符合身份证规范\n");
				objForm.certno.focus();
				return false;
			}
		}


		var certtype = objForm.certtype.value;
		if (certtype == "")
		{
			alert("请选择【证件类型】\n");
			objForm.certtype.focus();
			return false;
		}


		var mobile	= objForm.mobile.value;
		var mobilers =/^(1[0-9]{10})$/;
        if(!mobilers.test(mobile))
        {
			alert("【手机】格式不符合规范\n");
			objForm.mobile.focus();
			return false;
        }
*/
		var picIDPath	= objForm.picIDPath;

        if(picIDPath.value != "" && !check_loadfile(picIDPath))
        {
			return false;
        }
		var fcPicIDPath	= objForm.fcPicIDPath;
        if(fcPicIDPath.value != "" && !check_loadfile(fcPicIDPath))
        {
			return false;
        }

		var famSts	= objForm.famSts.value;
		var famStsSet	= objForm.famStsSet.value;
        if(famStsSet == "" && famSts != "")
        {
			objForm.famStsSet.value = "1"; 
        }
		
		var liveSts	= objForm.liveSts.value;
		var liveStsSet	= objForm.liveStsSet.value;
        if(liveStsSet == "" && liveSts != "")
        {
			objForm.liveStsSet.value = "1"; 
        }

		var inTime	= objForm.inTime.value;
		var inTimeSet	= objForm.inTimeSet.value;
        if(inTimeSet == "" && inTime != "")
        {
			objForm.inTimeSet.value = "1"; 
        }

		var home_location	= objForm.home_location.value;
		var home_Set	= objForm.home_Set.value;
        if(home_Set == "" && home_location != "")
        {
			objForm.home_Set.value = "1"; 
        }

		var highSchool	= objForm.highSchool.value;
		var college	= objForm.college.value;

		var schoolSet	= objForm.schoolSet.value;
        if(schoolSet == "" && (highSchool != "" || college !=""))
        {
			objForm.schoolSet.value = "1"; 
        }
		var isArmy	= objForm.isArmy.value;
		var army	= objForm.army.value;

		if(isArmy == "1" && (army == "" || army == "0"))
		{
			alert("【服役】请选择军种\n");
			objForm.isArmy.focus();
			return false;		
		}

		var armySet	= objForm.armySet.value;
        if(armySet == "" && army != "")
        {
			objForm.armySet.value = "1"; 
        }

		var work	= objForm.work.value;
		var workSet	= objForm.workSet.value;
        if(workSet == "" && work != "")
        {
			objForm.workSet.value = "1"; 
        }

		var skill	= objForm.skill.value;
		var skillSet	= objForm.skillSet.value;
        if(skillSet == "" && skill != "")
        {
			objForm.skillSet.value = "1"; 
        }

		var ids = document.getElementsByName("chkboxinterest"); 
		var inter = "";
		for (var i = 0; i < ids.length; i++) 
		{ 
			if(ids[i].checked){
				inter += ids[i].value;
				inter += ",";
			}
		} 
		objForm.interest.value = inter;

		var interestSet	= objForm.interestSet.value;
        if(interestSet == "" )
        {
			objForm.interestSet.value = "1"; 
        }

		return true;
	}

	function doConfirm()
	{

		var obj	= document.getElementById('theForm');
		if(!chkForm_new(obj))
		{
			return;
		}
		obj.submit();
	}


	function getVillageSelect(div,id)
	{

		if(id == 0 || id == ""){
			alert("请选择所在区县");
			return;
		}

		var xmlHttp;
		start = true;
		try
		{    // Firefox, Opera 8.0+, Safari    
			xmlHttp=new XMLHttpRequest();
		}
		catch (e)
		{    // Internet Explorer    
			try
			{
				xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
			}
			catch (e)
			{
				try
				{
					xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
				}
				catch (e)
				{
					alert("Your browser does not support AJAX!");
					return false;
				}
			}
		}
		var url;
		
		url = "${cpath}/shequ/getVillageSelect.jsp?work_area=" + id ;
		my_getbyid(div).innerHTML="<select name='villageID' onkeydown='catch_keydown(this);'></select>";
		if (start)
		{
			my_getbyid(div).innerHTML='后台取数据……';
			xmlHttp.onreadystatechange=function()
			{
				if(xmlHttp.readyState==4 && xmlHttp.status==200)
				{
					var ret_str = xmlHttp.responseText;

					var secsort = "<select name='villageID' onkeydown='catch_keydown(this);'>" +
							ret_str.replace(/(^\s*)|(\s*$)/g,"") + "</select>";
					my_getbyid(div).innerHTML = secsort;
				}
			}
			xmlHttp.open("GET",url,true);
			xmlHttp.send(null);
		}
	}

	function getAjaxdata(div,id)
	{

		var xmlHttp;
		start = true;
		try
		{    // Firefox, Opera 8.0+, Safari    
			xmlHttp=new XMLHttpRequest();
		}
		catch (e)
		{    // Internet Explorer    
			try
			{
				xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
			}
			catch (e)
			{
				try
				{
					xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
				}
				catch (e)
				{
					alert("Your browser does not support AJAX!");
					return false;
				}
			}
		}
		var url;
		if(div =="divsecsort"){

			url = "${cpath}/param/getproperty.jsp?assortID=2&parentID=" + id ;

		}else if(div =="cnpid" ){
		
			url = "${cpath}/param/getCnpid.jsp?pid=" + id ;
			my_getbyid("cncid").innerHTML="<select name='work_Area' onkeydown='catch_keydown(this);'></select>";
		}else if(div =="homepid" ){
		
			url = "${cpath}/param/getCnpid.jsp?pid=" + id ;
//			my_getbyid("homecid").innerHTML="<select name='work_Area' onkeydown='catch_keydown(this);'></select>";
		}else {

			url = "${cpath}/param/getCncid.jsp?cid=" + id;
		}
		if (start)
		{
			my_getbyid(div).innerHTML='后台取数据……';
			xmlHttp.onreadystatechange=function()
			{
				if(xmlHttp.readyState==4 && xmlHttp.status==200)
				{
					var ret_str = xmlHttp.responseText;
					if(div =="divsecsort"){
						var secsort = "<select name='secsort' onkeydown='catch_keydown(this);'>" +
							ret_str.replace(/(^\s*)|(\s*$)/g,"") + "</select>"
						my_getbyid(div).innerHTML = secsort;

					}else if(div =="cnpid"){

						var secsort = "<select name='work_sublocation' onkeydown='catch_keydown(this);' css='w70'" +
							" onChange=\"getAjaxdata('cncid',this.value)\">" + 
							ret_str.replace(/(^\s*)|(\s*$)/g,"") + "</select>"
						my_getbyid(div).innerHTML = secsort;

					}else if(div =="homepid"){

						var secsort = "<select name='home_sublocation' onkeydown='catch_keydown(this);' css='w70'" +
							" >" + 
							ret_str.replace(/(^\s*)|(\s*$)/g,"") + "</select>"
						my_getbyid(div).innerHTML = secsort;

					}else if(div =="homecid"){

						var secsort = "<select name='home_area' id='home_area' onkeydown='catch_keydown(this);'  css='w70'>" +
							ret_str.replace(/(^\s*)|(\s*$)/g,"") + "</select>"
						my_getbyid(div).innerHTML = secsort;

					}else{
						var secsort = "<select name='work_area' id='work_area' onkeydown='catch_keydown(this);'  onChange=\"getVillageSelect('villagediv',this.value)\" css='w70'>" +
							ret_str.replace(/(^\s*)|(\s*$)/g,"") + "</select>"
						my_getbyid(div).innerHTML = secsort;
					}
				}
			}
			xmlHttp.open("GET",url,true);
			xmlHttp.send(null);
		}
	}

	//mouse lost the chkpass box
	function check_certno_input(thisinput)
	{

		var chkcertno	= isIdCardNo(thisinput);
		if (chkcertno != "校验正确！")
		{
			alert(chkcertno);
//			thisinput.focus();
			return false;
		}

	}
	//这个可以验证15位和18位的身份证，并且包含生日和校验位的验证。   
	//如果有兴趣，还可以加上身份证所在地的验证，就是前6位有些数字合法有些数字不合法。 
	function isIdCardNo(thisinput) 
	{   

		var num = thisinput.value.toUpperCase();  
		//身份证号码为15位或者18位，15位时全为数字，18位前17位为数字，最后一位是校验位，可能为数字或字符X。   
		if (!(/(^\d{15}$)|(^\d{17}([0-9]|X)$)/.test(num)))   
		{ 
//		  alert('输入的身份证号长度不对，或者号码不符合规定！\n15位号码应全为数字，18位号码末位可以为数字或X。'); 
		  return '输入的身份证号长度不对'; 
		 } 
		//校验位按照ISO 7064:1983.MOD 11-2的规定生成，X可以认为是数字10。 
		//下面分别分析出生日期和校验位 
		var len, re; 
		len = num.length; 
		if (len == 15) 
		{ 
			re = new RegExp(/^(\d{6})(\d{2})(\d{2})(\d{2})(\d{3})$/); 
			var arrSplit = num.match(re); 

			//检查生日日期是否正确 
			var dtmBirth = new Date('19' + arrSplit[2] + '/' + arrSplit[3] + '/' + arrSplit[4]); 
			var bGoodDay; 
			bGoodDay = (dtmBirth.getYear() == Number(arrSplit[2])) && ((dtmBirth.getMonth() + 1) == Number(arrSplit[3])) && (dtmBirth.getDate() == Number(arrSplit[4])); 
			if (!bGoodDay) 
			{ 
				return '输入的身份证号里出生日期不对！'; 
			} 
			else 
			{ 
				//将15位身份证转成18位 
				//校验位按照ISO 7064:1983.MOD 11-2的规定生成，X可以认为是数字10。 
				var arrInt = new Array(7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2); 
				var arrCh = new Array('1', '0', 'X', '9', '8', '7', '6', '5', '4', '3', '2'); 
				var nTemp = 0, i;   
					num = num.substr(0, 6) + '19' + num.substr(6, num.length - 6); 
				for(i = 0; i < 17; i ++) 
				{ 
					nTemp += num.substr(i, 1) * arrInt[i]; 
				 } 
				 num += arrCh[nTemp % 11];  
				 thisinput.value = num;
				 return '校验正确！';   
			}   
		} 
		if (len == 18) 
		{ 
			re = new RegExp(/^(\d{6})(\d{4})(\d{2})(\d{2})(\d{3})([0-9]|X)$/); 
			var arrSplit = num.match(re); 

			//检查生日日期是否正确 
			var dtmBirth = new Date(arrSplit[2] + "/" + arrSplit[3] + "/" + arrSplit[4]); 
			var bGoodDay; 
			bGoodDay = (dtmBirth.getFullYear() == Number(arrSplit[2])) && ((dtmBirth.getMonth() + 1) == Number(arrSplit[3])) && (dtmBirth.getDate() == Number(arrSplit[4])); 
			if (!bGoodDay) 
			{ 
//				alert(dtmBirth.getYear()); 
//				alert(arrSplit[2]); 
//				alert('输入的身份证号里出生日期不对！'); 
				return '输入的身份证号里出生日期不对！'; 
			} else { 
				//检验18位身份证的校验码是否正确。 
				//校验位按照ISO 7064:1983.MOD 11-2的规定生成，X可以认为是数字10。 
				var valnum; 
				var arrInt = new Array(7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2); 
				var arrCh = new Array('1', '0', 'X', '9', '8', '7', '6', '5', '4', '3', '2'); 
				var nTemp = 0, i; 
				for(i = 0; i < 17; i ++) 
				{ 
					nTemp += num.substr(i, 1) * arrInt[i]; 
				} 
				valnum = arrCh[nTemp % 11]; 
				if (valnum != num.substr(17, 1)) 
				{ 
//					alert('18位身份证的校验码不正确！应该为：' + valnum); 
					return '18位身份证的校验码不正确'; 
				} 
				return '校验正确！'; 
			} 
		} 
		return '校验正确！'; 
	}

</script>